export const local = {
    set<T>(key: string, val: T) {
        localStorage.setItem(key, JSON.stringify(val))
    },

    get(key: string) {
        let value = localStorage.getItem(key) ?? ''
        if (!value) {
            return null
        }
        return JSON.parse(value)
    },
    
    remove(key: string) {
        localStorage.removeItem(key)
    },

    clear() {
        localStorage.clear()
    }
}